<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>any_completion_handler</title>
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../../boost_asio.html" title="Boost.Asio">
<link rel="up" href="../reference.html" title="Reference">
<link rel="prev" href="any_completion_executor/_any_completion_executor.html" title="any_completion_executor::~any_completion_executor">
<link rel="next" href="any_completion_handler/allocator_type.html" title="any_completion_handler::allocator_type">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
<td align="center"><a href="../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="any_completion_executor/_any_completion_executor.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../boost_asio.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="any_completion_handler/allocator_type.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="boost_asio.reference.any_completion_handler"></a><a class="link" href="any_completion_handler.html" title="any_completion_handler">any_completion_handler</a>
</h3></div></div></div>
<p>
        <a class="indexterm" name="boost_asio.indexterm.any_completion_handler"></a>
      </p>
<p>
        Polymorphic wrapper for completion handlers.
      </p>
<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span>
    <span class="keyword">typename</span><span class="special">...</span> <span class="identifier">Signatures</span><span class="special">&gt;</span>
<span class="keyword">class</span> <span class="identifier">any_completion_handler</span>
</pre>
<h5>
<a name="boost_asio.reference.any_completion_handler.h0"></a>
        <span class="phrase"><a name="boost_asio.reference.any_completion_handler.types"></a></span><a class="link" href="any_completion_handler.html#boost_asio.reference.any_completion_handler.types">Types</a>
      </h5>
<div class="informaltable"><table class="table">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
                <p>
                  Name
                </p>
              </th>
<th>
                <p>
                  Description
                </p>
              </th>
</tr></thead>
<tbody>
<tr>
<td>
                <p>
                  <a class="link" href="any_completion_handler/allocator_type.html" title="any_completion_handler::allocator_type"><span class="bold"><strong>allocator_type</strong></span></a>
                </p>
              </td>
<td>
                <p>
                  The associated allocator type.
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  <a class="link" href="any_completion_handler/cancellation_slot_type.html" title="any_completion_handler::cancellation_slot_type"><span class="bold"><strong>cancellation_slot_type</strong></span></a>
                </p>
              </td>
<td>
                <p>
                  The associated cancellation slot type.
                </p>
              </td>
</tr>
</tbody>
</table></div>
<h5>
<a name="boost_asio.reference.any_completion_handler.h1"></a>
        <span class="phrase"><a name="boost_asio.reference.any_completion_handler.member_functions"></a></span><a class="link" href="any_completion_handler.html#boost_asio.reference.any_completion_handler.member_functions">Member
        Functions</a>
      </h5>
<div class="informaltable"><table class="table">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
                <p>
                  Name
                </p>
              </th>
<th>
                <p>
                  Description
                </p>
              </th>
</tr></thead>
<tbody>
<tr>
<td>
                <p>
                  <a class="link" href="any_completion_handler/any_completion_handler.html" title="any_completion_handler::any_completion_handler"><span class="bold"><strong>any_completion_handler</strong></span></a> <span class="silver">[constructor]</span>
                </p>
              </td>
<td>
                <p>
                  Construct an any_completion_handler in an empty state, without
                  a target object. <br> <span class="silver"> —</span><br> Construct an any_completion_handler
                  to contain the specified target. <br> <span class="silver"> —</span><br> Move-construct an
                  any_completion_handler from another.
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  <a class="link" href="any_completion_handler/get_allocator.html" title="any_completion_handler::get_allocator"><span class="bold"><strong>get_allocator</strong></span></a>
                </p>
              </td>
<td>
                <p>
                  Get the associated allocator.
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  <a class="link" href="any_completion_handler/get_cancellation_slot.html" title="any_completion_handler::get_cancellation_slot"><span class="bold"><strong>get_cancellation_slot</strong></span></a>
                </p>
              </td>
<td>
                <p>
                  Get the associated cancellation slot.
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  <a class="link" href="any_completion_handler/operator_bool.html" title="any_completion_handler::operator bool"><span class="bold"><strong>operator bool</strong></span></a>
                </p>
              </td>
<td>
                <p>
                  Test if the polymorphic wrapper is empty.
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  <a class="link" href="any_completion_handler/operator_not_.html" title="any_completion_handler::operator!"><span class="bold"><strong>operator!</strong></span></a>
                </p>
              </td>
<td>
                <p>
                  Test if the polymorphic wrapper is non-empty.
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  <a class="link" href="any_completion_handler/operator_lp__rp_.html" title="any_completion_handler::operator()"><span class="bold"><strong>operator()</strong></span></a>
                </p>
              </td>
<td>
                <p>
                  Function call operator.
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  <a class="link" href="any_completion_handler/operator_eq_.html" title="any_completion_handler::operator="><span class="bold"><strong>operator=</strong></span></a>
                </p>
              </td>
<td>
                <p>
                  Move-assign an any_completion_handler from another. <br> <span class="silver"> —</span><br>
                  Assignment operator that sets the polymorphic wrapper to the empty
                  state.
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  <a class="link" href="any_completion_handler/swap.html" title="any_completion_handler::swap"><span class="bold"><strong>swap</strong></span></a>
                </p>
              </td>
<td>
                <p>
                  Swap the content of an any_completion_handler with another.
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  <a class="link" href="any_completion_handler/_any_completion_handler.html" title="any_completion_handler::~any_completion_handler"><span class="bold"><strong>~any_completion_handler</strong></span></a> <span class="silver">[destructor]</span>
                </p>
              </td>
<td>
                <p>
                  Destructor.
                </p>
              </td>
</tr>
</tbody>
</table></div>
<h5>
<a name="boost_asio.reference.any_completion_handler.h2"></a>
        <span class="phrase"><a name="boost_asio.reference.any_completion_handler.friends"></a></span><a class="link" href="any_completion_handler.html#boost_asio.reference.any_completion_handler.friends">Friends</a>
      </h5>
<div class="informaltable"><table class="table">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
                <p>
                  Name
                </p>
              </th>
<th>
                <p>
                  Description
                </p>
              </th>
</tr></thead>
<tbody>
<tr>
<td>
                <p>
                  <a class="link" href="any_completion_handler/operator_not__eq_.html" title="any_completion_handler::operator!="><span class="bold"><strong>operator!=</strong></span></a>
                </p>
              </td>
<td>
                <p>
                  Inequality operator.
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  <a class="link" href="any_completion_handler/operator_eq__eq_.html" title="any_completion_handler::operator=="><span class="bold"><strong>operator==</strong></span></a>
                </p>
              </td>
<td>
                <p>
                  Equality operator.
                </p>
              </td>
</tr>
</tbody>
</table></div>
<p>
        The <code class="computeroutput"><span class="identifier">any_completion_handler</span></code>
        class template is a polymorphic wrapper for completion handlers that propagates
        the associated executor, associated allocator, and associated cancellation
        slot through a type-erasing interface.
      </p>
<p>
        When using <code class="computeroutput"><span class="identifier">any_completion_handler</span></code>,
        specify one or more completion signatures as template parameters. These will
        dictate the arguments that may be passed to the handler through the polymorphic
        interface.
      </p>
<p>
        Typical uses for <code class="computeroutput"><span class="identifier">any_completion_handler</span></code>
        include:
      </p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
            Separate compilation of asynchronous operation implementations.
          </li>
<li class="listitem">
            Enabling interoperability between asynchronous operations and virtual
            functions.
          </li>
</ul></div>
<h5>
<a name="boost_asio.reference.any_completion_handler.h3"></a>
        <span class="phrase"><a name="boost_asio.reference.any_completion_handler.requirements"></a></span><a class="link" href="any_completion_handler.html#boost_asio.reference.any_completion_handler.requirements">Requirements</a>
      </h5>
<p>
        <span class="emphasis"><em>Header: </em></span><code class="literal">boost/asio/any_completion_handler.hpp</code>
      </p>
<p>
        <span class="emphasis"><em>Convenience header: </em></span><code class="literal">boost/asio.hpp</code>
      </p>
</div>
<div class="copyright-footer">Copyright © 2003-2025 Christopher M.
      Kohlhoff<p>
        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
      </p>
</div>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="any_completion_executor/_any_completion_executor.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../boost_asio.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="any_completion_handler/allocator_type.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
